<?php
/**
 * @link https://www.kancloud.cn/cleverstone/ymb2
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

namespace frontend\controllers;

use yii\web\ForbiddenHttpException;

/**
 * 控制器 - 临时维护
 */
class ShutdownController extends BaseController
{
    public $publicActions = [
        'index',
    ];

    public function actionIndex()
    {
        $response = $this->response;
        $response->setStatusCode(403);
        $message = '通知：站点临时关停，技术员紧急修复中，请耐心等待。';
        if ($this->isAjax) {
            return $this->as403($message);
        } else {
            $exception = new ForbiddenHttpException($message);
            return $this->render('/error/index', [
                'name' => $exception->getName(),
                'message' => $exception->getMessage(),
                'exception' => $exception,
            ]);
        }
    }
}